// 1.引入momentjs工具库  commonjs 模块化规范 
var moment = require('moment');
console.log(moment, 'moment对象');
// var now = new Date();//在不同环境下获取时间有差异
// var now = new Date('2023-8-22 14:34');
var now = new Date();//在不同环境下获取时间有差异
console.log(now.toString());
console.log(now.toLocaleString());
console.log(now.getFullYear(), '获取当前年份');
console.log(now.getMonth() + 1, '获取当前月份');//0-11
console.log(now.getDate(), '获取月份所对应天数');
console.log(now.getHours(), '获取当前小时');
console.log(now.getMinutes(), '获取当前分钟数');
console.log(now.getSeconds(), '获取当前秒数');
console.log(now.getDay(), '获取一周中几天');//0-6
console.log(now.getTime());//格林威治时间毫秒数 13位时间戳 

console.log(moment(now.getTime()).format('YYYY-MM-DD:HH:mm:ss'));